package FingerGame;
import java.util.Scanner;

public class Person {
    private String name;            // 名称
    private int score;              // 得分
    private String skills;          // 技能
    private int currentFingerNo;    // 当前出拳

    public Person() {
        //选择角色
        System.out.println("请选择玩家的角色：" +
                 "\n1-斯卡蒂" +
                "\n2-银灰" +
                "\n3-海猫" +
                "\n4-自定义（没有技能哦！）" +
                "\n输入数字(1-4)选择：");

        Scanner in = new Scanner(System.in);
        int roleNo=in.nextInt();
        switch (roleNo) { // 根据数字对应的角色名称给name赋值
            case 1:
                this.setInfo("斯卡蒂", 0, "搅动潮汐之剑(胜利时获得双倍积分)");
                break;
            case 2:
                this.setInfo("银灰", 0, "真银斩(平局时可视为胜利)");
                break;
            case 3:
                this.setInfo("海猫", 0, "ALL之力(施展后有50％的概率交换双方出拳)");
                break;
            case 4:
                System.out.println("请输入玩家名字：");
                String inputName = in.next();
                this.setInfo(inputName, 0, "无");
                break;
            default:
                System.out.println("输入错误捏，使用默认NPC角色");
                this.setInfo("路人甲", 0, "卖萌(施展后有1％的概率获得1得分)");
        }

        this.showInfo();
    }

    public String getName(){
        return name;
    }

    public void setName(String name){
        this.name = name;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public String getSkills() {
        return skills;
    }

    public void setSkills(String skills) {
        this.skills = skills;
    }

    public int getCurrentFingerNo() {
        return currentFingerNo;
    }

    public void setCurrentFingerNo(int currentFingerNo) {
        this.currentFingerNo = currentFingerNo;
    }

    public void setInfo(String name, int score, String skills){
        this.setName(name);
        this.setScore(score);
        this.setSkills(skills);
    }

    public void showInfo(){
        System.out.println("-----显示玩家角色信息-----\n" +
                            "角色名称：" + name + "\n" +
                            "初始积分：" + score + "\n" +
                            "技能：" + skills);
    }

    public void win(){
        int gain = 1;
        if (skills.contains("胜利时获得双倍积分")){
            gain = 2;
            System.out.println(name + " 发动技能 搅动潮汐之剑，获得双倍积分！");
        }
        score += gain;
        System.out.println("本局" + name + "获胜，积分：" + score);
    }

    String selectEnemyModel(){
        System.out.println("选择挑战难度\n"+
                            "1-简单\n"+
                            "2-困难\n");
        Scanner sc = new Scanner(System.in);
        int inputNumber = sc.nextInt();
        switch (inputNumber){
            case 1:
                System.out.println("简单模式");
                return "easy";
            case 2:
                System.out.println("困难模式");
                return "hard";
            default:
                System.out.println("错误，选择了不存在的难度");
                return "error";
        }
    }

    public void throwFinger() {
        Scanner in = new Scanner(System.in);
        int fingerNo;

        do {
            System.out.println("请输入数字1-剪刀，2-石头，3-布，进行出拳");
            fingerNo = in.nextInt();// 键盘输入出拳的数值

            switch (fingerNo) {
                case 1:
                    System.out.println("玩家出拳：剪刀");
                    break;
                case 2:
                    System.out.println("玩家出拳：石头");
                    break;
                case 3:
                    System.out.println("玩家出拳：布");
                    break;
                default:
                    System.out.println("请冷静一点");
            }

        } while (fingerNo < 1 || fingerNo > 3);

        this.setCurrentFingerNo(fingerNo);
    }
}
